package com.renyisima.wujiansima.demo;

import java.io.File;

public class Demo4 {
    public static void main(String[] args) {
        File file = new File("C:\\Users\\任意的爹\\Desktop\\src");
        deleteDir(file);
    }

    private static void deleteDir(File file) {
//        进入
        File[] files = file.listFiles();
//        遍历
        for (File file1 : files) {
//            判断
            if (file1.isFile()){
                file1.delete();
//                判断
            }else {
                deleteDir(file1);
            }
        }
        file.delete();

    }
}
